import java.util.Comparator;

import org.eclipse.swt.graphics.FontData;


public class FontItem implements Comparable<FontItem> {
    private FontData fontData;
    private boolean isInstalled;
    private String filePath;
    
    private static final Comparator<FontData> comp = new FontComparator(); 
    
    /**
     * @param fontData
     * @param isInstalled
     */
    public FontItem(FontData fontData, boolean isInstalled) {
        this(fontData, isInstalled, null);
    }
    /**
     * @param fontData
     * @param isInstalled
     * @param filePath
     */
    public FontItem(FontData fontData, boolean isInstalled,
            String filePath) {
        this.fontData = fontData;
        this.isInstalled = isInstalled;
        this.filePath = filePath;
    }
    
    public boolean isInstalled() {
        return isInstalled;
    }
    
    public void setInstalled(boolean isInstalled) {
        this.isInstalled = isInstalled;
    }
    
    public FontData getFontData() {
        return fontData;
    }
    
    public String getFilePath() {
        return filePath;
    }
    
    public int compareTo(FontItem o) {
        return comp.compare(fontData, o.getFontData());
    }
    
    @Override
    public boolean equals(Object o) {
        return compareTo((FontItem) o) == 0;
    }
    
    @Override
    public int hashCode() {
        return fontData.hashCode();
    }
}
